[T Z]=rk4sgral(0,20,[0,0],10000,'finalF');

for i=1:1:size(T(:))
   
   if(T(i)>=1)
       Z(i,1) = 1 - Z(i,1);
   else
       Z(i,1) = 0 - Z(i,1);
   end
end
plot(T', Z(:,1), 'r-');